import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, ScrollView } from '@tarojs/components'
import HotSale from './hotsale/index'
import UpToDate from './uptodate/index'
import MoreProd from './moreprod/index'
import './index.scss'

export default class Product extends Taro.Component {
    static defaultProps = {
        list: []
    }
    render() {
        const { list } = this.props
        return (
            <View>
                {(list || []).map(item => {
                    return (
                        <View>
                            <View className='content'>
                                {
                                    item.style === '2' &&
                                    // 每日上新 
                                    <UpToDate list={item} />
                                }
                            </View>
                            <View>
                                {
                                    item.style === '1' &&
                                    // 商城热卖 
                                    <HotSale list={item} />
                                }
                            </View>
                            <View>
                                {
                                    item.style === '0' &&
                                    //更多宝贝
                                    <MoreProd list={item} />
                                }
                            </View>
                        </View>
                    )
                })}
            </View>
        )
    }
}

